// 路由规则和路由实例化对象
import Vue from 'vue';
import VueRouter from 'vue-router';

import Index from '../components/index/Index.vue';
import Film from '../components/film/Film.vue';
import Now from '../components/film/Now.vue';
import Soon from '../components/film/Soon.vue';
import Detail from '../components/detail/Detail.vue';
import Cinema from '../components/cinema/Cinema.vue';
import Login from '../components/person/Login.vue';

Vue.use(VueRouter);

export default new VueRouter({
    routes:[
        {
            path:'/index',
            name:'index',
            component:Index
        },
        {
            path:'/film',
            name:'film',
            component:Film,
            redirect:'/film/now',
            children:[
                {
                    path:'now',
                    name:'now',
                    component:Now
                },
                {
                    path:'soon',
                    name:'soon',
                    component:Soon
                }
            ]
        },        
        {
            path:'/film/:id',
            name:'detail',
            component:Detail
        },
        {
            path:'/district/cinema',
            name:'cinema',
            component:Cinema
        },
        {
            path:'/users/login',
            name:'login',
            component:Login
        },
        {
            path:'*',
            redirect:'/index'
        }
    ]
})